<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title>Ionic App</title>
    <base href="./"/>
    <meta name="color-scheme" content="light dark"/>
    <meta name="viewport" content="viewport-fit=cover,width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="msapplication-tap-highlight" content="no"/>
    <link rel="shortcut icon" type="image/png" href="./ionic/assets/icon/favicon.png"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-title" content="Ionic App"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    
    <link href="./ionic/css/chunk-ionic.f5c8e0e3.css" rel="stylesheet">
    <link href="./ionic/css/app.7b141fc5.css" rel="stylesheet">
    
    <style>
        .debug-info {
            position: fixed;
            top: 10px;
            left: 10px;
            background: rgba(0,0,0,0.8);
            color: white;
            padding: 10px;
            border-radius: 5px;
            font-size: 12px;
            z-index: 9999;
            max-width: 250px;
        }
        
        /* 如果应用内容为空，显示加载提示 */
        #app:empty::before {
            content: "正在加载应用...";
            display: block;
            text-align: center;
            padding: 100px 20px;
            color: #666;
            font-size: 18px;
        }
    </style>
</head>
<body>
    <div id="app"></div>
    
    <div class="debug-info" id="debug">
        <div>🔄 应用启动中...</div>
    </div>
    
    <script>
        console.log('=== Ionic App Debug Mode ===');
        
        const debug = document.getElementById('debug');
        let messages = [];
        
        function log(msg) {
            console.log(msg);
            messages.push(new Date().toLocaleTimeString() + ': ' + msg);
            debug.innerHTML = messages.slice(-5).map(m => '<div>' + m + '</div>').join('');
        }
        
        log('✅ 页面开始加载');
        
        // 监听应用变化
        const observer = new MutationObserver(function(mutations) {
            mutations.forEach(function(mutation) {
                if (mutation.target.id === 'app' && mutation.target.children.length > 0) {
                    log('✅ 应用内容已加载');
                    log('📱 子元素数量: ' + mutation.target.children.length);
                    
                    // 3秒后隐藏调试信息
                    setTimeout(() => {
                        debug.style.display = 'none';
                    }, 3000);
                }
            });
        });
        
        observer.observe(document.getElementById('app'), {
            childList: true,
            subtree: true
        });
        
        // 定期检查应用状态
        let checkCount = 0;
        function checkApp() {
            checkCount++;
            const app = document.getElementById('app');
            
            if (app.children.length > 0) {
                log('✅ 应用已渲染');
                return;
            }
            
            if (checkCount % 10 === 0) {
                log(`⏳ 等待渲染... (${checkCount})`);
            }
            
            if (checkCount < 100) {
                setTimeout(checkApp, 500);
            } else {
                log('❌ 应用渲染超时');
                // 显示应用的 innerHTML 内容用于调试
                log('📋 App innerHTML: ' + (app.innerHTML.length > 0 ? '有内容' : '空'));
            }
        }
        
        window.addEventListener('load', () => {
            log('✅ 页面加载完成');
            setTimeout(checkApp, 1000);
        });
        
        // 监听错误
        window.addEventListener('error', (e) => {
            log('❌ 错误: ' + e.message);
        });
    </script>
    
    <!-- 使用与原始文件相同的脚本加载方式 -->
    <script defer="defer" type="module" src="./ionic/js/chunk-ionic.b2c76632.js"></script>
    <script defer="defer" type="module" src="./ionic/js/chunk-vendors.9a24fe1a.js"></script>
    <script defer="defer" type="module" src="./ionic/js/app.39054f79.js"></script>
    <script defer="defer" src="./ionic/js/chunk-ionic-legacy.b2c76632.js" nomodule></script>
    <script defer="defer" src="./ionic/js/chunk-vendors-legacy.30a74f52.js" nomodule></script>
    <script defer="defer" src="./ionic/js/app-legacy.55c5c7f4.js" nomodule></script>
</body>
</html>